package es.udc.fic.hamNeggs.pojo;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import java.io.Serializable;
import java.sql.Date;

@Entity
@Table(name = "hamneggs.works")
public class Works implements Serializable {

    @Id
    @ManyToOne
    @JoinColumn(name = "usr_id")
    private User    user;

    @Id
    @ManyToOne
    @JoinColumn(name = "prj_id")
    private Project project;

    @Column(name = "wrk_dateStart")
    private Date    dateStart;

    @Column(name = "wrk_dateEnd")
    private Date    dateEnd;

    @Column(name = "wrk_rol")
    @Enumerated(EnumType.STRING)
    private Rol     rol;

    public enum Rol {
        ProductOwner("ProductOwner"),
        DevelopmentTeam("DevelopmentTeam"),
        ScrumMaster("ScrumMaster"),
        StakeHolder("StakeHolder");

        private final String rol;

        private Rol(final String rol) {
            this.rol = rol;
        }

        public String getString() {
            return rol;
        }
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public Project getProject() {
        return project;
    }

    public void setProject(Project project) {
        this.project = project;
    }

    public Date getDateStart() {
        return dateStart;
    }

    public void setDateStart(Date dateStart) {
        this.dateStart = dateStart;
    }

    public Date getDateEnd() {
        return dateEnd;
    }

    public void setDateEnd(Date dateEnd) {
        this.dateEnd = dateEnd;
    }

    public Rol getRol() {
        return rol;
    }

    public void setRol(Rol rol) {
        this.rol = rol;
    }

}
